package com.xml.controller;

import com.alibaba.fastjson.JSONObject;
import com.xml.pojo.BsCompany;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xml E-Mail:kaioct@qq.com
 * @date 2021/3/26
 * @desc gridreportjavaspringboot
 * @created 2021-03-26 17:04
 **/
@RestController
@RequestMapping("/data")
public class DataController {


    @RequestMapping("/companylist")
    public String getDta() {
        List<BsCompany> dataList=new ArrayList<BsCompany>();
        BsCompany company=null;
        for(int i=0;i<50;i++){
            company=new BsCompany();
            company.setCustomerID("HUNGC"+i);
            company.setCompanyName("五金机械"+i);
            company.setContactName("苏先生"+i);
            company.setContactTitle("销售代表"+i);
            company.setAddress("德昌路甲 29 号"+i);
            company.setCity("大连"+i);
            company.setRegion("东北"+i);
            company.setPostalCode("564576"+i);
            company.setCountry("中国");
            company.setPhone("(053) 5556874");
            company.setFax("(053) 5552376");
            dataList.add(company);
        }
        JSONObject jsonObj = new JSONObject();
        jsonObj.put("code", 200);
        jsonObj.put("message", "成功");
        jsonObj.put("Table", dataList);
        /*
        "Table":[
        {"CustomerID":"HUNGC","CompanyName":"五金机械","ContactName":"苏先生","ContactTitle":"销售代表","Address":"德昌路甲 29 号","City":"大连","Region":"东北","PostalCode":"564576","Country":"中国","Phone":"(053) 5556874","Fax":"(053) 5552376"},
        {"CustomerID":"CENTC","CompanyName":"三捷实业","ContactName":"王先生","ContactTitle":"市场经理","Address":"英雄山路 84 号","City":"大连","Region":"东北","PostalCode":"130083","Country":"中国","Phone":"(061) 15553392","Fax":"(061) 15557293"},
]
    }*/
        return jsonObj.toJSONString();
    }
}
